package calao.client.ui;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;

public class Elements 
{

	static final String WIDTH_ATTR = "width"; 

	public static void setBackgroundColor(Element elem, String color)
	{
		DOM.setStyleAttribute(elem, "backgroundColor", color);
	}

	public static String getWidth(Element element)
	{
		return DOM.getStyleAttribute(element, WIDTH_ATTR);
	}
	
	public static void setWidth(Element elem, String width)
	{
		DOM.setStyleAttribute(elem, WIDTH_ATTR, width);
	}

	public static void setWidth(Element elem, int pixels)
	{
		setWidth(elem, ""+pixels+"px");
	}

	public static void setHeight(Element elem, String height)
	{
		DOM.setStyleAttribute(elem, "height", height);
	}
	
	public static void setHeight(Element elem, int pixels)
	{
		setHeight(elem, ""+pixels+"px");
	}

	public static void setTop(Element elem, int pixels)
	{
		DOM.setStyleAttribute(elem, "top", ""+pixels+"px");
	}

	public static void setLeft(Element elem, int pixels)
	{
		DOM.setStyleAttribute(elem, "left", ""+pixels+"px");
	}

	public static void setVerticalAlign(Element elem, String align)
	{
		DOM.setStyleAttribute(elem, "verticalAlign", align);	
	}

	public static void setTextAlign(Element elem, String align)
	{
		DOM.setStyleAttribute(elem, "textAlign", align);	
	}

	public static void removeChild(Element elem, int childIndex)
	{
		DOM.removeChild(elem, DOM.getChild(elem, childIndex));
	}
	
}
